/**
 * 
 */
package com.ssm.controller.admin;

import java.util.Properties;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ssm.controller.SSMController;
import com.ssm.model.mapper.ActionLogMapper;
import com.ssm.model.mapper.ActionMapper;
import com.ssm.model.mapper.ApiMapper;
import com.ssm.model.mapper.GroupsMapper;
import com.ssm.model.mapper.ResourcesMapper;
import com.ssm.model.mapper.UserMapper;
import com.ssm.model.mapper.UserRuleMapper;

/**
 * 
 * @author 危文涛<245108903@qq.com>
 * @version 2016年2月19日 下午7:20:57
 *
 */
@Controller
@RequestMapping(value="home")
public class HomeController extends AdminBaseController {

	@RequestMapping(value="index")
	public String index(HttpServletRequest request)
	{
		UserMapper userMapper=M.getMapper(UserMapper.class);
		ActionLogMapper alogM=M.getMapper(ActionLogMapper.class);
		ActionMapper am=M.getMapper(ActionMapper.class);
		ApiMapper apiM=M.getMapper(ApiMapper.class);
		GroupsMapper gM=M.getMapper(GroupsMapper.class);
		ResourcesMapper resourcesM=M.getMapper(ResourcesMapper.class);
		UserRuleMapper userruleM=M.getMapper(UserRuleMapper.class);
		Properties props=System.getProperties();
		request.setAttribute("usernum",userMapper.selectAll().size());
		request.setAttribute("useractionnum",am.selectAll().size());
		request.setAttribute("resourcesnum",resourcesM.selectAll().size());
		request.setAttribute("apinum",apiM.selectAll().size());
		request.setAttribute("javaVersion",props.getProperty("java.version"));
		request.setAttribute("osName",props.getProperty("os.name"));
		request.setAttribute("osArch",props.getProperty("os.arch"));
		return "home/index";
	}
}
